<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>无限参数</title>
</head>
<body>
<script>
    //任意数量参数求和
    function sum(){
        var result = 0,
                i=0,
                len=arguments.length;
        while(i<len){
            result += arguments[i];
            i++;
        }
        return result;
    }
    sum(1,2,3);
    console.log(sum(1,2,3));
    console.log(sum(1,2,3).length);
    console.log(sum(1,2,3));
    console.log(sum.length);
</script>
</body>
</html>